#include <assert.h>
#include <ctype.h>
#include <locale.h>
#include <errno.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>


void ptrdiff(void)
{
    printf("***** ptrdiff *****\n");
    int a[2];
    int * p1 = &a[0], * p2 = &a[1];
    ptrdiff_t pd = p2 - p1; // 1 = 0061FEEC - 0061FEF0 = 4bytes
    printf("p1 = %p\n", (void*) p1);
    printf("p2 = %p\n", (void*) p2);
    printf("p2 - p1 = %d\n", pd);
}



int main()
{
    printf("printf: Hello, world!\n");


    char *s="abc";
    char a[]="abc"; //{'a','b','c','\0'}
    printf("typeof(*str): %d\n", sizeof(*s)); // 1
    printf("typeof(a): %d\n", sizeof(a)); //4
    printf("*s %p\n", s);

    char *str = s;
    puts(str);

    char y = 'c'; /* Variable y holds the value 99. Returns 99
    * (as the character 'c' is represented in the ASCII table with 99).
    */
   printf("y: %d\n", y);
   printf("y: %c\n", y);

    ptrdiff();
    system("pause");
    return 0;
}

/*
Headers are usually files containing function declarations,
macros and data types, and you must include the header file before you use them.

In C programs, every statement needs to be terminated by a semi-colon (i.e. ;).


We can also use the warning options -Wall -Wextra -Werror, 
that help to identify problems that can cause the program to fail or produce unexpected results. 
They are not necessary for this simple program but this is way of
adding them:
    gcc -Wall -Wextra -Werror -o hello hello.c

*/

#if 0 /* Starts the "comment", anything from here on is removed by preprocessor */
/* A large amount of code with multi-line comments */
int foo()
{
/* lots of code */
...
/* ... some comment describing the if statement ... */
if (someTest) {
/* some more comments */
return 1;
}
return 0;
}
#endif /* 0 */